<?php 
$params = Yii::app()->controller->getActionParams();
if (!empty($params)) {
    foreach($params as $key => $value) {
        if ($key == 'lang')
            $langParam = $value;
    }
}
?>

<?php
$this->breadcrumbs=array(
	'San Phams',
);

$this->menu=array(
	array('label'=>Yii::t('translation', 'CreateProduct'), 'url'=>array('create')),
	array('label'=>Yii::t('translation', 'ManageProduct'), 'url'=>array('admin')),
);
?>

<h1><?php echo Yii::t('translation', 'Product') ?></h1>

<?php
    foreach($model as $m)
    {  // loop to get the data (this is different from the complex way)

?>
        <div class="product_box">
            <a href="<?php echo Yii::app()->request->baseUrl;?>/index.php?r=sanPham/view&id=<?php echo $m->IDSP;?><?php if (!empty($langParam)) echo "&lang=".$langParam; ?>">
                <img src="<?php echo Yii::app()->request->baseUrl; echo"/images/products/";?><?php echo $m->HINHANH ?> "/>
            </a>
            <h3><?php echo $m->TENSP; ?></h3>
            <p class="product_price"><?php echo number_format($m->GIATIEN,0,".",","); ?></p>
            <a href="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=sanPham/update&id=<?php echo $m->IDSP?><?php if (!empty($langParam)) echo "&lang=".$langParam; ?>" class="add_to_card">Sửa</a>
            <a href="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=sanPham/delete&id=<?php echo $m->IDSP?><?php if (!empty($langParam)) echo "&lang=".$langParam; ?>" class="detail">Xóa</a>
        </div>
<?php
    }
    echo '<div style="clear: both;"></div>';
    echo '<div style="text-align: center;">';
    // display pagination
    $this->widget('CLinkPager', array(
    'pages' => $pages,
    ));
    echo '</div>';
?>







